﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WeakScript
{
    public class WeakVar
    {
        public enum InternalType { NONE = 0, FLT = 2, STR = 3, CHR = 4, BOOL = 5, REF = 6, MRK = 7}

        public InternalType InnerType { get; set; }

        public double floatValue;
        public string stringValue;
        public char charValue;
        public bool boolValue;

        public WeakObject refValue;
        public long TypeID { get; set; }

        public bool IsConst     { get; set; }

        public string Name      { get; set; }
        public string Context   { get; set; }

        public WeakVar()
        {
            Name = "tmp";
            InnerType = InternalType.NONE;
            floatValue = 0;
            stringValue = "";
            charValue = (char)0;
            boolValue = false;
            refValue = null;
        }

        public override string ToString()
        {
            string str = Name + " = ";
            if (InnerType == WeakVar.InternalType.CHR) str += charValue.ToString();
            else if (InnerType == WeakVar.InternalType.FLT) str += floatValue.ToString();
            else if (InnerType == WeakVar.InternalType.STR) str += stringValue.ToString();
            return str;
        }
    }
}
